# -*- coding: utf-8 -*-
"""
@Time    : 2024/9/12 15:49 
@Author  : ZhangShenao 
@File    : dao.py
@Desc    : 用户Dao
"""
from entity import UserEntity


class UserDao:
    """用户Dao"""

    def __init__(self):
        """
        构造函数
        """

        # 初始化用户数据
        self._user_data = {
            1: UserEntity(user_id=1, username="zsa", age=18),
            2: UserEntity(user_id=2, username="Tom", age=6),
            3: UserEntity(user_id=3, username="Jerry", age=5),
        }

    def select_by_id(self, user_id: int) -> UserEntity:
        """
        根据user_id查询用户
        :param user_id: 用户ID
        :return: 用户信息
        """

        return self._user_data.get(user_id)
